package com.fastmobile.util;

import java.io.File;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Util {
	public static String changeBooleanValue(Boolean value) {
		if (null == value) {
			return null;
		}
		if (Boolean.FALSE == value) {
			return "0";
		} else {
			return "1";
		}
	}
	
	public static Double parseDouble(String value) {
		if (null == value) {
			return null;
		}
		
		try {
			return Double.parseDouble(value);
		} catch (Exception e) {
			return null;
		}
	}
	
	public static Boolean parseBoolean(String value) {
		if (null == value) {
			return null;
		}
		if ("1".equals(value)) {
			return Boolean.TRUE;
		} else {
			return Boolean.FALSE;
		}
	}
}
